package day10;

class Person {

    public String name;
    public int age = 0;
    public String sex;

    public Person(String name, int age, String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }

    public Person(){
        System.out.println("初始化年龄："+age);
    }

    void value(){
        System.out.println("------");
    }

    public int GetAge(int age){
        this.age = age;
        return this.age;
    }

    public Person(int age) {
        this.age = age;
    }

    public Person(String name) {
        this.name = name;
    }

    public Person(int age, String name) {
        //this(参数);是调用构造方法，注意改行代码必须放在另外一个构造方法的第一行。

        //this(age);

        this(name);
        //this.name = name;

        this.age=age;
    }

    public static void main(String[] args) {
        Person Harry = new Person();
        System.out.println("Harry's age is "+Harry.GetAge(12));
        Person person = new Person(15,"asd");
        System.out.println(person.age);
        System.out.println(person.name);

    }

}